home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / X11 / dox-9.1 / xshlogo.sh < prev   
Linux/UNIX/POSIX Shell Script  |  1995-06-22  |  4KB  |  184 lines

  1. #! /bin/sh
  2.  
  3. : '@(#)xshlogo.sh    9.1'
  4.  
  5. : 1994    Arthur David Olson
  6. :
  7. : The X Consortium, and any party obtaining a copy of these files from
  8. : the X Consortium, directly or indirectly, is granted, free of charge, a
  9. : full and unrestricted irrevocable, world-wide, paid up, royalty-free,
  10. : nonexclusive right and license to deal in this software and
  11. : documentation files {the "Software"}, including without limitation the
  12. : rights to use, copy, modify, merge, publish, distribute, sublicense,
  13. : and/or sell copies of the Software, and to permit persons who receive
  14. : copies from any such party to do so.  This license includes without
  15. : limitation a license to do the foregoing actions under any patents of
  16. : the party supplying this software to the X Consortium.
  17.  
  18. echo hi | read 2>&- || exec ksh "$0" ${1+"$@"}
  19.  
  20. O="`basename $0`"
  21.  
  22. flags=
  23.  
  24. while :
  25. do
  26.     case $1 in
  27.         --)        shift ; break ;;
  28.         -display|-d)    shift
  29.                 case $# in
  30.                     0)    set x ; break ;;
  31.                     *)    flags="$flags -display $1"
  32.                         shift ;;
  33.                 esac ;;
  34.         *)        break ;;
  35.     esac
  36. done
  37.  
  38. case $# in
  39.     0)    ;;
  40.     *)    echo "$O: usage is $O" \
  41.             "[-d displayname]" \
  42.             "[-display displayname]" \
  43.             "# 9.1" >&2
  44.         exit 1 ;;
  45. esac
  46.  
  47. width=64
  48. height=64
  49.  
  50. # Since the cooperating process ends up in a NextEvent loop,
  51. # and is started off in "signal(SIGINT, SIG_IGN)" mode by ksh,
  52. # it will fail to notice immediately if we ourselves are interrupted.
  53. # So we ask for the opportunity to end it.
  54.  
  55. case `trap` in
  56.     *2:*3:*|*3:*2:)    ;;
  57.     *2:*)    trap 'kill 0' 3 ;;
  58.     *3:*)    trap 'kill 0' 2 ;;
  59.     *)    trap 'kill 0' 2 3 ;;
  60. esac
  61.  
  62. dox -verbose $flags |&
  63.  
  64. print -p createsimplewindow root 0 0 $width $height 1 black white
  65. read -p window
  66. print -p selectinput $window exposure+structurenotify
  67. print -p storename $window \""$O"\"
  68. print -p seticonname $window \""$O"\"
  69. print -p mapwindow $window
  70.  
  71. while :
  72. do
  73.     set -e
  74.     print -p nextevent
  75.     read -p type balance
  76.     case "$type" in
  77.         ConfigureNotify)    set $balance
  78.                     while :
  79.                     do
  80.                         case $1 in
  81.                             width)    width=$2 ;;
  82.                             height)    height=$2 ;;
  83.                         esac
  84.                         shift
  85.                         case $# in
  86.                             0)    break ;;
  87.                         esac
  88.                     done
  89.                     continue ;;
  90.     esac
  91.     case "$balance" in
  92.         *" 0")    ;;
  93.         *)    continue ;;
  94.     esac
  95.     set +e
  96.     (( size = width ))
  97.     if (( size > height ))
  98.     then
  99.         (( size = height ))
  100.     fi
  101.     if (( size % 2 != 0 ))
  102.     then
  103.         (( size = size - 1 ))
  104.     fi
  105.     if (( size <= 0 ))
  106.     then
  107.         (( size = 2 ))
  108.     fi
  109.     (( x = ( width - size ) / 2 ))
  110.     (( y = ( height - size ) / 2 ))
  111.     (( d11 = size / 11 ))
  112.     if (( d11 < 1 ))
  113.     then
  114.         (( d11 = 1 ))
  115.     fi
  116.     (( d21 = ( d11 + 3 ) / 4 ))
  117.     (( d31 = d11 + d11 + d21 ))
  118.  
  119.     (( p0x = x + size ))
  120.     (( p0y = y ))
  121.     (( p1x = x + size - d31 ))
  122.     (( p1y = y ))
  123.     (( p2x = x ))
  124.     (( p2y = y + size ))
  125.     (( p3x = x + d31 ))
  126.     (( p3y = y + size ))
  127.     points="$p0x $p0y $p1x $p1y $p2x $p2y $p3x $p3y"
  128.     print -p setforeground defaultgc black
  129.     print -p setbackground defaultgc white
  130.     print -p fillpolygon $window defaultgc $points convex origin
  131.  
  132.     (( p0x = x + d31 / 2 ))
  133.     (( p0y = y + size ))
  134.     (( p1x = x + size / 2 ))
  135.     (( p1y = y + size / 2 ))
  136.     (( p2x = x + ( size / 2 ) + ( d31 - ( d31 / 2 ) ) ))
  137.     (( p2y = y + size / 2 ))
  138.     (( p3x = x + d31 ))
  139.     (( p3y = y + size ))
  140.     points="$p0x $p0y $p1x $p1y $p2x $p2y $p3x $p3y"
  141.     print -p setforeground defaultgc white
  142.     print -p setbackground defaultgc black
  143.     print -p fillpolygon $window defaultgc $points convex origin
  144.  
  145.     (( p0x = x + size - d31 / 2 ))
  146.     (( p0y = y ))
  147.     (( p1x = x + size / 2 ))
  148.     (( p1y = y + size / 2 ))
  149.     (( p2x = x + ( size / 2 ) - ( d31 - ( d31 / 2 ) ) ))
  150.     (( p2y = y + size / 2 ))
  151.     (( p3x = x + size - d31 ))
  152.     (( p3y = y ))
  153.     points="$p0x $p0y $p1x $p1y $p2x $p2y $p3x $p3y"
  154.     print -p setforeground defaultgc white
  155.     print -p setbackground defaultgc black
  156.     print -p fillpolygon $window defaultgc $points convex origin
  157.  
  158.     (( p0x = x ))
  159.     (( p0y = y ))
  160.     (( p1x = x + size / 4 ))
  161.     (( p1y = y ))
  162.     (( p2x = x + size ))
  163.     (( p2y = y + size ))
  164.     (( p3x = x + size - size / 4 ))
  165.     (( p3y = y + size ))
  166.     points="$p0x $p0y $p1x $p1y $p2x $p2y $p3x $p3y"
  167.     print -p setforeground defaultgc black
  168.     print -p setbackground defaultgc white
  169.     print -p fillpolygon $window defaultgc $points convex origin
  170.  
  171.     (( p0x = x + size - d11 ))
  172.     (( p0y = y ))
  173.     (( p1x = x + size - ( d11 + d21 ) ))
  174.     (( p1y = y ))
  175.     (( p2x = x + d11 ))
  176.     (( p2y = y + size ))
  177.     (( p3x = x + d11 + d21 ))
  178.     (( p3y = y + size ))
  179.     points="$p0x $p0y $p1x $p1y $p2x $p2y $p3x $p3y"
  180.     print -p setforeground defaultgc white
  181.     print -p setbackground defaultgc black
  182.     print -p fillpolygon $window defaultgc $points convex origin
  183. done
  184.